<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       img{
        width:320px;
        height:160px;
       }
       .big-picture img{
        width:640px;
        height:320px;
       }
       .big-picture{
           position: absolute;
       }
    </style>
</head>
<body>
    <img src="./images/1.png" alt="">
    <div class="big-picture"></div>
    <script>
        let img = document.querySelector("img")
        let bigpicture = document.querySelector(".big-picture")
        img.onmouseenter= function(){
            // bigpicture.innerHTML = `<img src = '${this.src}'>` //这句是核心 获取元素地址
            bigpicture.innerHTML = `<img src = ./images/2.png>`
        }
        img.onmouseleave= function(){
            bigpicture.innerHTML = ""
        }
        img.onmousemove = function(e){
            let x= e.clientX;
            let y= e.clientY;
            bigpicture.style.top = y +10 +"px"
            bigpicture.style.left = x  +"px"
        }
    </script>
</body>
</html>